home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Abacus diskdrives IO.adf / CH5 / fullassign.c < prev    next >
C/C++ Source or Header  |  1978-06-28  |  3KB  |  143 lines

  1. /*-----------------------------------------------------*/
  2. /*            ASSIGN-Function for AmigaDOS             */
  3. /*                                                     */
  4. /*                    JEA, 18-08-87                    */
  5. /*-----------------------------------------------------*/
  6. #include <libraries/dos.h>
  7. #include <libraries/dosextens.h>
  8. #include <libraries/filehandler.h>
  9.  
  10. extern struct DosLibrary *DOSBase;
  11. UBYTE *dtl_types[] = {
  12. "Device   : ",
  13. "Directory: ",
  14. "Volume   : "
  15. };
  16.  
  17. /*-----------------------------------------------------*/
  18. /*            Convert BSTR into C-String               */
  19. /*                                                     */
  20. /*                                                     */
  21. /*-----------------------------------------------------*/
  22. BstrC( bstr, buf )
  23. BSTR *bstr;
  24. UBYTE *buf;
  25. {
  26. UBYTE *str;
  27. LONG loop;
  28. LONG counter;
  29.  
  30.    counter = 0;
  31.    str = (UBYTE*) BADDR( bstr );
  32.    for( loop = (LONG) str[0]; loop--; ++counter){
  33.       buf[counter] = str[counter+1];
  34.    }
  35.    buf[counter] = 0;
  36. }
  37.  
  38. /*-----------------------------------------------------*/
  39. /*                  output BPTR-String                 */
  40. /*                                                     */
  41. /*                                                     */
  42. /*-----------------------------------------------------*/
  43. BstrOut( bstr )
  44. BSTR *bstr;
  45. {
  46. UBYTE buf[80];
  47.  
  48.    BstrC( bstr, buf );
  49.    printf( buf );
  50. }
  51.  
  52. /*-----------------------------------------------------*/
  53. /*               Output ASSIGN Entries                 */
  54. /*                                                     */
  55. /*                                                     */
  56. /*-----------------------------------------------------*/
  57. FindeAssign()
  58. {
  59. struct RootNode   *rootnode;
  60. struct DosInfo    *dosinfo;
  61. struct DeviceList *devicelist;
  62. struct FileLock   *filelock;
  63.  
  64.    rootnode   = (struct RootNode*)   DOSBase->dl_Root;
  65.    dosinfo    = (struct DosInfo*)    BADDR( rootnode->rn_Info );
  66.    devicelist = (struct DeviceList*) BADDR( dosinfo->di_DevInfo );
  67.    while( devicelist->dl_Next ){
  68.       printf( dtl_types[devicelist->dl_Type] );
  69.       BstrOut( devicelist->dl_Name );
  70.       printf( "\n" );
  71.       devicelist = (struct DeviceList*) BADDR(     devicelist->dl_Next );
  72.    }
  73. }
  74.  
  75. /*-----------------------------------------------------*/
  76. /*                       Main program                  */
  77. /*                                                     */
  78. /*                                                     */
  79. /*-----------------------------------------------------*/
  80. main()
  81. {
  82.    FindeAssign();
  83. }
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.